package com.chuangmei.com.ar;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.FrameLayout;

import com.chuangmei.com.R;
import com.unity3d.player.UnityPlayerNativeActivity;

public class ShowARActivity extends UnityPlayerNativeActivity implements View.OnClickListener {

    private FrameLayout u3dLayout;
    private Button mBT_ar_return;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_show_ar);
        initView();
        initData();

    }

    private void initView() {
        u3dLayout = (FrameLayout) findViewById(R.id.u3d_layout);
        mBT_ar_return = (Button) this.findViewById(R.id.mBT_ar_return);
        mBT_ar_return.setOnClickListener(this);
    }

    private void initData() {
        View view = mUnityPlayer.getView();
        u3dLayout.addView(view);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.mBT_ar_return:
                //                Intent intent = getIntent();
                //                intent.setClass(this, MainActivity.class);
                //                startActivity(intent);
                finish();
                break;
        }
    }

    //    @Override
    //    public boolean onKeyDown(int i, KeyEvent keyEvent) {
    //        switch (i) {
    //            case KeyEvent.KEYCODE_BACK:
    //                return true;
    //
    //        }
    //        return super.onKeyDown(i, keyEvent);
    //    }
}
